import { Space, Card, Typography } from "tdesign-react";
import HightLightCode from "@/components/HightLightCode";
import { conditionalCode } from "@/config";
import "../index.less";

const { Text, Title, Paragraph } = Typography;
const Conditional = () => {
	return (
		<Card>
			<Space direction="vertical" style={{ width: "100%" }}>
				<Title level="h3">条件渲染</Title>
				<Paragraph>在React中，条件渲染是一种根据特定条件动态决定是否渲染某个组件或元素，或者渲染不同组件或元素的技术。</Paragraph>
				<Title level="h3">基本用法</Title>
				{conditionalCode.map((item, index) => {
					return (
						<Space direction="vertical" key={index}>
							<Title level="h5">{item.title}</Title>
							<Text>{item.introduce}</Text>
							<HightLightCode code={item.code} />
						</Space>
					);
				})}
			</Space>
		</Card>
	);
};

export default Conditional;
